package com.gyf.crm.service.impl;

import com.gyf.crm.mapper.CourseOrderMapper;
import com.gyf.crm.model.CourseOrder;
import com.gyf.crm.model.PageResult;
import com.gyf.crm.service.ICourseOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class CourseOrderServiceImpl implements ICourseOrderService {
    @Autowired
    CourseOrderMapper orderMapper;

    @Override
    public PageResult<CourseOrder> findPageResult(CourseOrder condition, int page, int pageSize) {
        //定义一个 Map-参数先不放在 map,后面再处理
        Map<String,Object> params = new HashMap<>();
//定义结果
        params.put("start",(page-1)*pageSize);
        params.put("limit",pageSize);
        PageResult<CourseOrder> result = new PageResult<>();
        result.setCount(orderMapper.findCountByMap(params));
        result.setData(orderMapper.findListByMap(params));
        return result;
    }
}
